
<?php 
	global $base_url;
	$baseurl = BASECH;
?>
	<div id="result_go" class="result_inner">
	<div class="go_view"><div class="back_btn"><span><?php echo l(t('Back'),'go_view/dept'); ?></span></div>
<?php	
	foreach ($items as $res){
	
		//print "<pre>"; print_r($res); print "</pre>";
		
		$dept = $res->field_go_depart_value;
		$deptName = get_govt_dept_names($dept); 
		$abstract =  $res->field_go_abstract_value; 
		$filepath = $res->uri;
		$title = $res->title;
		$go_date = SUBSTR($res->field_go_date_value,0,10); 
		//echo $Year = $go_date->format('d-m-Y');
		$go_date_check = date(strtotime($go_date));
		$goYear = date("Y", strtotime($go_date));
		
		if(empty($filepath)){		
							$wrapper = file_stream_wrapper_get_instance_by_uri($res->uri);
                               
							if($wrapper == true){
								$filepath = $wrapper->getDirectoryPath() . "/" . file_uri_target($res->uri);
							}
							$icon = '';
					}else{
						  	$icon = get_pdf_icon($filesize)	; 
						 	//$filepath = $baseurl.$contentlist->filepath;	
							$wrapper = file_stream_wrapper_get_instance_by_uri($res->uri);
                               
							if($wrapper == true){
								$filepath = $wrapper->getDirectoryPath() . "/" . file_uri_target($res->uri);
								
							}//$department= $contentlist -> dept_name;	
						  
					}
					
					/*if($res->field_go_available_file['und']['0']['filesize'] != 0){
						
							$kb = ceil($res->field_go_available_file['und'][0]['filesize']/1024);
						$kbyte= $kb.KB;
						if($kb >1024) { 
						  $kb = ceil($kb/1024);
						  $kbyte= $kb.MB;
						}
					}*/
		
		if( $goYear != $go_year )		{ 
					$go_year = $goYear;
					$divOutput1 = "<div class='res_dept go_depart' ><strong>Year : " .  $goYear  . "</strong></div>";
				}
				else		{
					$divOutput1 = '';
				}
		
		if( $deptName != $curdept )		{
			$curdept = $deptName;
			$divOutput =   $deptName ;
						
		}
		else		{
			$divOutput = '';
		}
	?>
	<!--<div class="go_title"><?php //echo $newDate;?><span style="padding:10px;"><?php echo $abstract;?></span> </div>
	<div class="go_abstract"><?php //echo $title; ?></div>-->
	
	<div class="go_box">
				<div class="res_dept go_depart"><span><strong><?php echo $divOutput;?></strong></span></div>
				<div class="go_title"><?php echo $divOutput1 ;?></div>
				
				<div class="go_abstract"><a target="_blank" href='http://cms.tn.gov.in/<?php echo $filepath;?>'>
				<?php print $title . " Dt: ". $go_date_check.$icon."(".$kbyte. ")";?></a>
				  <div class="go_abstract_descr"><?php echo $abstract; ?></div></div>
	</div>

<?php  } ?>

	<!--</div>
		<div class="clr"></div>
	</div>-->
